package com.edu.com;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.webkit.WebView;

public class AndroidtrackingActivity extends Activity 
{
	private static final String HTML_ROOT = "file:///android_asset/www/";
	private static final String VIEW_INTRO = "intro.html";

	private Handler handler;
	
	private WebView webView;
    
    @Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		webView = new WebView(this);
		setContentView(webView);

		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setDomStorageEnabled(true);
		webView.getSettings().setGeolocationEnabled(true);
		
		handler = new Handler();
		webView.addJavascriptInterface(this, "enjoyEatSupport");
		loadPage(VIEW_INTRO);
	}

	public void loadPage(String page)
	{
		final String url = HTML_ROOT + page;
		loadURL(url);
	}

	private void loadURL(final String url)
	{
		handler.post(new Runnable()
		{
			@Override
			public void run()
			{
				webView.loadUrl(url);
			}
		});
	}
}